package young.Util;


import java.sql.*;
import java.util.ArrayList;
import java.util.List;

public class Sql {
    public Connection getConnection() {

        // 1. 加载驱动
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        // 2. 创建连接
        Connection con = null;
        try {
            con = DriverManager.getConnection(
                    "jdbc:mysql://localhost:3306/young?userSSL=true&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT",
                    "root", "5911591");
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        System.out.println("con:" + con);


        return con;


    }
}


